//
//  CBPeripheral+Addition.m
//  UDKLib
//
//  Created by idiot.lin on 15/5/12.
//  Copyright (c) 2015年 biao.rao. All rights reserved.
//
#import <objc/runtime.h>
#import "CBPeripheral+Addition.h"

static const char *locNameKey = "btLocalName";
static const char *ServiceUUIDList = "ServiceUUIDList";
static const char *deviceTypeKey = "deviceType";

@implementation CBPeripheral (Addition)

- (NSString *)btLocalName
{
    return objc_getAssociatedObject(self, locNameKey);
}


- (void)setBtLocalName:(NSString *)btLocalName
{
    objc_setAssociatedObject(self, locNameKey, btLocalName, OBJC_ASSOCIATION_COPY_NONATOMIC);
}

- (void)setDeviceType:(DeviceType)deviceType
{
    objc_setAssociatedObject(self, deviceTypeKey, @(deviceType), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (DeviceType)deviceType
{
    NSNumber * devType =  objc_getAssociatedObject(self, deviceTypeKey);
    return [devType integerValue];
}


- (NSArray *)btServiceUUIDList
{
    return objc_getAssociatedObject(self, ServiceUUIDList);
}

- (void)setBtServiceUUIDList:(NSArray *)btServiceUUIDList
{
    objc_setAssociatedObject(self,ServiceUUIDList , btServiceUUIDList, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

@end



